$(function () {
    window.confirm = function (message, callback) {
        var shield = document.createElement("DIV");
        shield.id = "shield";
        shield.style.position = "absolute";
        shield.style.left = "50%";
        shield.style.top = "50%";
        shield.style.width = "280px";
        shield.style.height = "150px";
        shield.style.marginLeft = "-140px";
        shield.style.marginTop = "-110px";
        shield.style.zIndex = "25";
        var alertFram = document.createElement("DIV");
        alertFram.id = "alertFram";
        alertFram.style.position = "absolute";
        alertFram.style.width = "280px";
        alertFram.style.height = "150px";
        alertFram.style.left = "50%";
        alertFram.style.top = "50%";
        alertFram.style.marginLeft = "-140px";
        alertFram.style.marginTop = "-110px";
        alertFram.style.textAlign = "center";
        alertFram.style.lineHeight = "150px";
        alertFram.style.zIndex = "30000";
        var strHtml = "";
        strHtml += "<div  style='position: fixed;top: 0; left: 0;right: 0;bottom: 0; background: rgba(0, 0, 0, 0);z-index: 20000; width: 100%; height: 100%;'>";
        strHtml += "<ul style=\"width:50%;margin: 25% 50% 50% 25%;\">\n";
        strHtml += " <li style=\"background:#0b5052;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px solid #F9CADE;color:white\"></li>\n";
        strHtml += " <li style=\"background:#5f9ea0;text-align:center;font-size:12px;height:95px;line-height:95px;border-left:1px solid #F9CADE;border-right:1px solid #F9CADE;color:#DCC722\">" + message + "</li>\n";
        strHtml += " <li style=\"background:#0b5052;text-align:center;font-weight:bold;height:30px;line-height:25px; border:1px solid #F9CADE;\"><input type=\"button\" value=\"确 定\" onclick=\"doOk()\" style=\"width:80px;height:20px;background:#0b5052;color:white;border:1px solid white;font-size:14px;line-height:20px;outline:none;margin-top: 4px\"/>";
        strHtml += "<input type=\"button\" value=\"取 消\" onclick=\"doCancle()\" style=\"width:80px;height:20px;background:#0b5052;color:white;border:1px solid white;font-size:14px;line-height:20px;outline:none;margin-top: 4px\"/>";
        strHtml += "</li>\n";
        strHtml += "</ul>\n";
        strHtml += "</div>";
        alertFram.innerHTML = strHtml;
        document.body.appendChild(alertFram);
        document.body.appendChild(shield);
        this.doOk = function () {
            // alertFram.style.display = "none";
            // shield.style.display = "none";
            $(alertFram).remove();
            callback && callback();
        }
        this.doCancle = function () {
            alertFram.style.display = "none";
            shield.style.display = "none";
        }
        alertFram.focus();

    },
        window.alert = function (str, title) {
            if (str == null) {
                str = "";
            }
            if (title == null) {
                title = "提示";
            }

            var shield = document.createElement("DIV");
            shield.id = "shield";
            shield.style.position = "absolute";
            shield.style.left = "50%";
            shield.style.top = "50%";
            shield.style.width = "280px";
            shield.style.height = "150px";
            shield.style.marginLeft = "-140px";
            shield.style.marginTop = "-110px";
            shield.style.zIndex = "25";
            var alertFram = document.createElement("DIV");
            alertFram.id = "alertFram";
            alertFram.style.position = "absolute";
            alertFram.style.width = "280px";
            alertFram.style.height = "150px";
            alertFram.style.left = "50%";
            alertFram.style.top = "50%";
            alertFram.style.marginLeft = "-140px";
            alertFram.style.marginTop = "-110px";
            alertFram.style.textAlign = "center";
            alertFram.style.lineHeight = "150px";
            alertFram.style.zIndex = "30000";
            var strHtml = "";
            strHtml += "<div  style='position: fixed;top: 0; left: 0;right: 0;bottom: 0; background: rgba(0, 0, 0, 0);z-index: 20000; width: 100%; height: 100%;'>";
            strHtml += "<ul style=\"width:50%;margin: 25% 50% 50% 25%;\">\n";
            strHtml += " <li style=\"background:#0b5052;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px solid #F9CADE;color:white\">" + title + "</li>\n";
            strHtml += " <li style=\"background:#5f9ea0;text-align:center;font-size:12px;height:95px;line-height:95px;border-left:1px solid #F9CADE;border-right:1px solid #F9CADE;color:#DCC722\">" + str + "</li>\n";
            strHtml += " <li style=\"background:#0b5052;text-align:center;font-weight:bold;height:30px;line-height:25px; border:1px solid #F9CADE;\"><input type=\"button\" value=\"确 定\" onclick=\"doOk()\" style=\"width:80px;height:20px;background:#0b5052;color:white;border:1px solid white;font-size:14px;line-height:20px;outline:none;margin-top: 4px\"/></li>\n";
            strHtml += "</ul>\n";
            strHtml += "</div>";
            alertFram.innerHTML = strHtml;
            document.body.appendChild(alertFram);
            document.body.appendChild(shield);
            this.doOk = function () {
                alertFram.style.display = "none";
                shield.style.display = "none";
            }
            alertFram.focus();
            document.body.onselectstart = function () {
                return false;
            };
        }
})
var index_js = {
    reloadRightPage: function () {
        var link = $("#page_right").attr("link");
        $("#page_right").html("");
        index_js.loadRightPage(link);
    },
    loadRightPage: function (link) {
        if (link != null) {
            var url = base.basePath + link;
            JWB.http.requestHtml(url, function (res) {
                $("#page_right").html(res);
                $("#page_right").attr("link", link);
            });
        }
    },
    // showFloatage: function (html) {
    //     $("#floatageBox").removeClass("hidden");
    //     $("#floadtageCentent").html(html);
    //
    // },
    // hiddenFloatage: function () {
    //     $("#floatageBox").addClass("hidden");
    //     $("#floadtageCentent").html("");
    // },
    appendHtmlByUrl: function (url) {
        console.log(url)
        JWB.http.requestHtml(url, function (res) {
            // console.log(res)
            $("body").append(res);
        });
    }
}